home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / POV-Ray 3.0.2 / src / SOURCE / MESH.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-02  |  4.6 KB  |  113 lines  |  [TEXT/CWIE]

  1. /****************************************************************************
  2. *                   mesh.h
  3. *
  4. *  This module contains all defines, typedefs, and prototypes for MESH.C.
  5. *
  6. *  from Persistence of Vision(tm) Ray Tracer
  7. *  Copyright 1996 Persistence of Vision Team
  8. *---------------------------------------------------------------------------
  9. *  NOTICE: This source code file is provided so that users may experiment
  10. *  with enhancements to POV-Ray and to port the software to platforms other
  11. *  than those supported by the POV-Ray Team.  There are strict rules under
  12. *  which you are permitted to use this file.  The rules are in the file
  13. *  named POVLEGAL.DOC which should be distributed with this file. If
  14. *  POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  15. *  Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  16. *  Forum.  The latest version of POV-Ray may be found there as well.
  17. *
  18. * This program is based on the popular DKB raytracer version 2.12.
  19. * DKBTrace was originally written by David K. Buck.
  20. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  21. *
  22. *****************************************************************************/
  23.  
  24.  
  25. #ifndef MESH_H
  26. #define MESH_H
  27.  
  28. #include "bbox.h"
  29.  
  30.  
  31.  
  32. /*****************************************************************************
  33. * Global preprocessor defines
  34. ******************************************************************************/
  35.  
  36. #define MESH_OBJECT (PATCH_OBJECT+HIERARCHY_OK_OBJECT)
  37.  
  38.  
  39.  
  40. /*****************************************************************************
  41. * Global typedefs
  42. ******************************************************************************/
  43.  
  44. typedef struct Mesh_Struct MESH;
  45. typedef struct Mesh_Data_Struct MESH_DATA;
  46. typedef struct Mesh_Triangle_Struct MESH_TRIANGLE;
  47.  
  48. struct Mesh_Struct
  49. {
  50.   OBJECT_FIELDS
  51.   TRANSFORM *Trans;  /* Transformation for this object. */
  52.   MESH_DATA *Data;   /* Mesh data holding triangles.    */
  53. };
  54.  
  55. struct Mesh_Data_Struct
  56. {
  57.   int References;                /* Number of references to the mesh. */
  58.   long Number_Of_Normals;        /* Number of normals in the mesh.    */
  59.   long Number_Of_Textures;       /* Number of textures in the mesh.   */
  60.   long Number_Of_Triangles;      /* Number of trinagles in the mesh.  */
  61.   long Number_Of_Vertices;       /* Number of vertices in the mesh.   */
  62.   SNGL_VECT *Normals, *Vertices; /* Arrays of normals and vertices.   */
  63.   TEXTURE **Textures;            /* Array of texture references.      */
  64.   MESH_TRIANGLE *Triangles;      /* Array of triangles.               */
  65.   BBOX_TREE *Tree;               /* Bounding box tree for mesh.       */
  66. };
  67.  
  68. struct Mesh_Triangle_Struct
  69. {
  70.   unsigned int Smooth:1;         /* Is this a smooth triangle.            */
  71.   unsigned int Dominant_Axis:2;  /* Dominant axis.                        */
  72.   unsigned int vAxis:2;          /* Axis for smooth triangle.             */
  73.   long P1, P2, P3;               /* Indices of triangle vertices.         */
  74.   long Normal_Ind;               /* Index of unsmoothed triangle normal.  */
  75.   long Texture;                  /* Index of triangle texture.            */
  76.   SNGL Distance;                 /* Distance of triangle along normal.    */
  77.   long N1, N2, N3;               /* Indices of smoothed triangle normals. */
  78.   SNGL_VECT Perp;                /* Vector used for smooth triangles.     */
  79. };
  80.  
  81.  
  82.  
  83. /*****************************************************************************
  84. * Global variables
  85. ******************************************************************************/
  86.  
  87. extern METHODS Mesh_Methods;
  88.  
  89.  
  90. /*****************************************************************************
  91. * Global functions
  92. ******************************************************************************/
  93.  
  94. MESH *Create_Mesh PARAMS((void));
  95. int Compute_Mesh_Triangle PARAMS((MESH_TRIANGLE *Triangle, int Smooth, VECTOR P1, VECTOR P2, VECTOR P3, VECTOR S_Normal));
  96. void Compute_Mesh_BBox PARAMS((MESH *Mesh));
  97. void Init_Mesh_Triangle PARAMS((MESH_TRIANGLE *Triangle));
  98. void Build_Mesh_BBox_Tree PARAMS((MESH *Mesh));
  99. void Test_Mesh_Opacity PARAMS((MESH *Blob));
  100.  
  101. void Create_Mesh_Hash_Tables PARAMS((void));
  102. void Destroy_Mesh_Hash_Tables PARAMS((void));
  103. int Mesh_Hash_Vertex PARAMS((int *Number_Of_Vertices, int *Max_Vertices, SNGL_VECT **Vertices, VECTOR Vertex));
  104. int Mesh_Hash_Normal PARAMS((int *Number_Of_Normals, int *Max_Normals, SNGL_VECT **Normals, VECTOR Normal));
  105. int Mesh_Hash_Texture PARAMS((int *Number_Of_Textures, int *Max_Textures, TEXTURE ***Textures, TEXTURE *Texture));
  106. int Mesh_Degenerate PARAMS((VECTOR P1, VECTOR P2, VECTOR P3));
  107. void Initialize_Mesh_Code PARAMS((void));
  108. void Deinitialize_Mesh_Code PARAMS((void));
  109.  
  110.  
  111.  
  112. #endif
  113.